import os
import signal
import traceback
from os.path import join,dirname,abspath

import time

PROJECT_DIR = dirname(dirname(abspath(__file__)))

import sys
sys.path.insert(0,PROJECT_DIR)
from django.core.wsgi import get_wsgi_application
# sys.path.append(r'D:\Python35\lib\site-packages')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cyh.settings")

try:
    application = get_wsgi_application()
    print('WSGI without exception')
except Exception as e:
    print('handling WSGI exception')
    # Error loading applications
    if 'mod_wsgi' in sys.modules:
        traceback.print_exc()
        # os.kill(os.getpid(), signal.SIGINT)
        time.sleep(2.5)
